package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpHRSkillNewCategoryPageUtil extends SeleniumPageUtil {
	public final static By SMNC_LINK_NEW_CATEGORY = By.xpath("//*[@id='a9a65e3e-ff9d-44a4-a825-403dedfd5021']/a");
	public final static By SMNC_SPAN_HEADER = By.id("ctl44_hdrSkillMaintenance_lblHeader");
	public final static By SMNC_LINK_SAVE = By.xpath("//*[@id='0790172a-861a-45e1-a408-ef42dcc1dcb3']/a");
	public final static By SMNC_LINK_CLOSE = By.xpath("//*[@id='3cf044f9-6c2e-4ab3-aeee-5af093c46053']/a");
	public final static By SMNC_TD_CATEGORY = By.xpath("//*[@id='dvMaintItemEdit']/table[2]/tbody/tr[1]/td[1]");
	public final static By SMNC_INPUT_CATEGORY = By.id("ctl44_txtCategory");
	
	public static void enterSkillMaintenanceNewCategoryPage(){
		SpHRSkillMaintenancePageUtil.enterHRSkillMaintenancePage();
		SeleniumUtil.click(SeleniumUtil.findElement(SpHRSkillMaintenancePageUtil.SMM_LINK_NEW));
		SeleniumUtil.click(SeleniumUtil.findElement(SMNC_LINK_NEW_CATEGORY));
		waitForPageToLoad();
	}
	
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				SMNC_LINK_SAVE, SMNC_LINK_CLOSE, SMNC_INPUT_CATEGORY
			});
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(SMNC_LINK_SAVE));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(SMNC_LINK_CLOSE));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(SMNC_INPUT_CATEGORY));
	}
}
